#include "cute.h"
#include "ide_listener.h"
#include "cute_runner.h"
#include "MyClass.h"
#include "Caller.h"

#include <stdlib.h>
#include <iostream>
using namespace std;

Caller * CallerInst;

void MyClass_Mutiply_Test1()
{
	StatusType Status = OK;
	char FunctionName[] = "Multiply";
	char Params[] = "1,2";
	char Errors[MAX_ERROR_SIZE];
	char Returns[MAX_RETURN_SIZE];

	CallerInst->Call(&Status, FunctionName, Params, Returns, Errors, 0, NULL);

	//ASSERT(Errors[0] == 0);
	ASSERT(atoi(Returns) == 2);
}

void MyClass_Mutiply_Test2()
{
	StatusType Status = OK;
	char FunctionName[] = "Multiply";
	char Params[] = "2,6";
	char Errors[MAX_ERROR_SIZE];
	char Returns[MAX_RETURN_SIZE];

	CallerInst->Call(&Status, FunctionName, Params, Returns, Errors, 0, NULL);

	//ASSERT(Errors[0] == 0);
	ASSERT(atoi(Returns) == 12);
}

void MyClass_Mutiply_Test3()
{
	StatusType Status = OK;
	char FunctionName[] = "Multiply";
	char Params[] = "6,2";
	char Errors[MAX_ERROR_SIZE];
	char Returns[MAX_RETURN_SIZE];

	CallerInst->Call(&Status, FunctionName, Params, Returns, Errors, 0, NULL);

	//ASSERT(Errors[0] == 0);
	ASSERT(atoi(Returns) == 12);
}


void runSuite()
{
	cute::suite s;

	// ADD your test here
	s.push_back(CUTE(MyClass_Mutiply_Test1));
	s.push_back(CUTE(MyClass_Mutiply_Test2));
	s.push_back(CUTE(MyClass_Mutiply_Test3));



	cute::ide_listener lis;
	cute::makeRunner(lis)(s, "Test via Rcally");
}

int main()
{
	CallerInst = new Caller();

	int Res = 0;
	if ((Res = CallerInst->Initialize("10.0.0.1", 0)) != CALLER_OK)
	{
		//cout << "Caller init error: " << Res << endl;
		return -1;
	}

   runSuite();

	CallerInst->Finalize();
}



